Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues with tabbing into virtualized list #13826

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

grokys
Copy link
Member

@grokys grokys commented Dec 4, 2023

What does the pull request do?

As described in #11878, there were some problems with tabbing into a virtualized list:

We previously had logic in place to not recycle the focused element which meant that when the focused element was scrolled out of view, pressing one of the arrow keys would cause the focus to jump back to the correct selection, however that logic didn't work when tabbing into the control.

The solution for this is:

  • Make TabOnceActiveElement always follow the anchor index, so it's always equal to the last focused element
  • Use TabOnceActiveElement to decide when to not recycle an element instead of using actual keyboard focus. This means that the focused element isn't recycled even when focus is currently away from the items control

Fixed issues

Fixes #11878

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0042630-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Dec 5, 2023
Merged via the queue into master with commit 62314a0 Dec 5, 2023
7 checks passed
@maxkatz6 maxkatz6 deleted the fixes/11878-initial-selection branch December 5, 2023 02:33
@maxkatz6 maxkatz6 added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Dec 5, 2023
maxkatz6 pushed a commit that referenced this pull request Dec 5, 2023
* Add failing unit test for scenario 1 in #11878.

* Set TabOnceActiveElement on realized container.

Fixes scenario 1 in #11878.

* Use TabOnceActiveElement to decide focused element.

Fixes scenario #3 in #11878.
@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tabbing into a ListBox should always focus the selected item
3 participants